home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / TransSkel / Convenience / SkelPause.c < prev   
Text File  |  1994-02-20  |  711b  |  31 lines

  1. /*
  2.  * SkelPause ()
  3.  *
  4.  * Pause process execution for the given length of time, measured in ticks
  5.  * (60ths of a second).  If running in a multitasking environment, gives
  6.  * time to other processes, using the wait value that's appropriate for
  7.  * whether the application's in the foreground or background.
  8.  */
  9.  
  10. # include    "TransSkel.h"
  11.  
  12.  
  13. pascal void
  14. SkelPause (long ticks)
  15. {
  16. long    current;
  17. long    waitTime;
  18. EventRecord    event;
  19.  
  20.     if (SkelQuery (skelQInForeground))
  21.         SkelGetWaitTimes (&waitTime, (long *) nil);
  22.     else
  23.         SkelGetWaitTimes ((long *) nil, &waitTime);
  24.     current = TickCount ();
  25.     while (TickCount () < current + ticks)
  26.     {
  27.         if (SkelQuery (skelQHasWNE))
  28.             (void) WaitNextEvent (0, &event, waitTime, nil);
  29.     }
  30. }
  31.